Skip to content

Limit number of images uploaded at a time #3124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

harith96
Copy link

Images that can be uploaded at a time has to be limited (current max. number : 5) to avoid the issue of users uploading a lot of unnecessary images.

Fixes ##3101 Limit on number of images uploaded at once

Changes

As the number of images selected at a time cannot be limited in Android Image Picker and to avoid redundant code the functionality of removing images was integrated into the existing image upload flow.
Each thumbnail of top card has a close button and users can delete a image using that button at any time during upload process.
If user has selected too many images an error icon will be displayed next to the top card title and an dialog will be displayed if user clicks the error icon mentioning the
max. number of images allowed and min. number of images that have to be deleted. And also user will not be able to progress to select the category until there are only max. number of images in the selection. (The next button on the last image fragment will be disabled and a toast will be displayed if user clicks next button on the last image fragment.)

Tests - no new unit tests were written as all the new function were written in UploadActivity class and ThumbnailsAdapter class related to the UI.

Screenshots showing what changed (optional - for UI changes)

Screenshot_2019-08-12-10-41-53-147_fr free nrw commons beta
Screenshot_2019-08-12-10-42-24-950_fr free nrw commons beta

harith96 added 10 commits August 6, 2019 12:11
…load at once

UploadMediaDetailFragment : changed next button onclick function to handle too many images. (View pager will not allowed to go to category fragment if there are too many images)
added update UI process to a seprate function to handle fragment reload after an image is deleted. added too_many_images static flag
…pager

UploadPresentere.java : reoved hide top card if delete index is last image as if last image is deleted then the new last image will be displayed
UploadMediaDetailFragment.java : improved existing code
…ard which indicates whether there are images more than 5 images. This icon will be visible if there are more than 5 images and gone when user removes images left less than or equal to 5.

activity_upload.xml : added error icon to top card to indicate user there is an error (In this case there are more than 5 images in the selection)
…g the last image, the current selected position should be decremented. Added comments where needed.
…st image fragment as soon as to gray if there are too many images. implemented Toast of too many images using ViewUtil

UploadActivity.java : implemented top card error icon onClick function to show alert dialog
UploadPresenter.java : moved maximum no of images allowed static variable from UploadActivity
strings.xml : added string values for too many images alert box title and message and toast message
…on and error icon

Icon Files : new image remove icon
item_upload_thumbnail.xml : small changes to UI to position remove icon correctly in right upper corner of the thumbnail
Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add tests to make sure this change works as expected?

@harith96
Copy link
Author

All the new functions are in view layer. Therefore no new unit tests have been written as mentioned in the description .

@maskaravivek maskaravivek self-requested a review August 12, 2019 07:13
@harith96
Copy link
Author

@ilgazer @maskaravivek Would be great if someone could review this code and provide feedback.

@neslihanturan
Copy link
Collaborator

This PR is old and has several conflicts. On the other hand, the code does the job. @harith96 thanks a lot for this PR, are you interested to fix conflicts? If not other volunteers are encouraged to claim this PR and solve it by inspiration from this code:)

@neslihanturan
Copy link
Collaborator

Closing since this PR seems like sleeping. I noted that this code can be revisited to inspire from under issue page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants